﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace SettingsLab
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            if (Properties.Settings.Default.CallUpgrade)
            {
                Properties.Settings.Default.Upgrade();
                Properties.Settings.Default.CallUpgrade = false;
            }
            txbAge.Text = Properties.Settings.Default.Age.ToString();
            txbName.Text = Properties.Settings.Default.Name;
            txbAge.Text = Properties.Settings.Default.Age.ToString();
            
            
        }

        private void BtnReload_OnClick(object sender, RoutedEventArgs e)
        {
            Properties.Settings.Default.Reload();
            txbAge.Text = Properties.Settings.Default.Age.ToString();
        }

        
        private void BtnSave_OnClick(object sender, RoutedEventArgs e)
        {
            Properties.Settings.Default.Age = uint.Parse(txbAge.Text);
            Properties.Settings.Default.Save();
            txbAge.Text = Properties.Settings.Default.Age.ToString();
        }

        private void BtnReset_OnClick(object sender, RoutedEventArgs e)
        {
            Properties.Settings.Default.Reset();
            txbAge.Text = Properties.Settings.Default.Age.ToString();
        }
    }
}
